#ifndef SNCascadeClassifier_h__
#define SNCascadeClassifier_h__
//----------------------------------------------------------------------------
#include "opencv2\core\core.hpp"
#include <QString>
#include "SNCVParams.h"
#include "SNFeatureParams.h"
#include "SNCascadeBoostParams.h"
#include "SNCascadeParams.h"
#include "SNCascadeImageReader.h"
#include "SNFeatureEvaluator.h"
#include "SNCascadeBoost.h"
//----------------------------------------------------------------------------
class SNCascadeClassifier 
{
public:
	SNCascadeClassifier();
	~SNCascadeClassifier();
	bool Train( const QString cascade_dir_name, 
				const QString pos_filename,
				const QString neg_filename,
				int num_pos, 
				int num_neg,
				int precalc_val_bufsize, 
				int precalc_idx_bufsize,
				int num_stages,
				const SNCascadeParams& cascade_params,
				const SNFeatureParams& feature_params,
				const SNCascadeBoostParams& stage_params,
		bool baseFormatSave = false);

	SNCascadeParams CascadeParams;
	cv::Ptr<SNFeatureParams> FeatureParams;
	cv::Ptr<SNCascadeBoostParams> StageParams;

	cv::Ptr<SNFeatureEvaluator> FeatureEvaluator;
	std::vector<cv::Ptr<SNCascadeBoost> > StageClassifiers;
	SNCascadeImageReader ImgReader;
	int NumStages;
	int CurNumSamples;
	int NumPos;
	int NumNeg;

private:
	bool UpdateTrainingSet(double& acceptanceRatio);
	int FillPassedSamples(int first, int count, bool is_positive, int64& consumed);
	int Predict(int sample_idx);
};
//----------------------------------------------------------------------------

#endif // SNCascadeClassifier_h__

